package com.efuture.chaptersix

/* @Description: 注解@JvmField与Kotlin
 * @Auther: zhaoshanshan
 * @Date: 2022/03/11/11:39 下午
 */
class Person {
    @JvmField
    val names = listOf("Zhangsan", "Lisi", "Wangwu")

    //这样java调用直接可以使用该属性 不需要调用该函数get方法
//    Person p = new Person();
//    System.out.println(p.names)
}

/* 背后的原理代码：

    public final class Person{

        @NotNull
        private final List names = CollectionsKt.listOf(new String[]{"Zhangsan", "Lisi", "Wangwu"});

        // val 只读的，只有 getNames
        public final List getNames() {
            return this.names;
        }
    }



    @JvmField 背后会剔除私有代码 成员
    public final class Person {
       @JvmField
       @NotNull
       public final List names = CollectionsKt.listOf(new String[]{"Zhangsan", "Lisi", "Wangwu"});
    }
 */
    